<%--
  Created by IntelliJ IDEA.
  User: hp
  Date: 2020/7/13
  Time: 2:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="true" %>
<html>
<head>
    <title>出库单</title>
    <%@include file="/common/com.jsp"%>
</head>
<body>
<div id="root">
    <template>
        <Collapse active-key="1">
            <Panel name="Panel">
                多条件查询
                <p slot="content">
                    <i-form :label-width="60" inline>
                        <Form-Item label="商品名字">
                            <i-input type="text" v-model="DeliveredVo.deliveredName"></i-input>
                        </Form-Item>
                        <Form-Item label="商品类型">
                            <i-input type="text" v-model="DeliveredVo.deliveredType"></i-input>
                        </Form-Item>
                        <Form-Item label="成本价格">
                            <i-input type="text" v-model="DeliveredVo.deliveredUnitPrice"></i-input>
                        </Form-Item>
                        <i-button type="primary" shape="circle" icon="ios-search" @click="pageNo=1;getdeliveredlist();" >搜索</i-button>
                    </i-form>
                </p>
            </Panel>
        </Collapse>

    </template>
    <card>
        <i-button type="primary" shape="circle" @click="getdeliveredlist()"><Icon type="ios-refresh"></Icon>刷新</i-button>
    </card>
    <i-table :columns="columns" :data="data" border stripe height="400">
        <template slot-scope="{row,index}" slot="action">
            <i-Button type="info" @click="returnout(row,index)">退回出库</i-Button>
            <i-Button type="info" @click="out(row,index)">出库</i-Button>
        </template>

    </i-table>

    <template>
        <Page :total="total"
              show-elevator
              :page-size="pageSize"
              style="margin-left: 340px;margin-top:15px"
              :current.sync="pageNo"
              show-sizer
              prev-text="上一页"
              next-text="下一页"
              :page-size-opts="[5,10,20,30,40]"
              show-total
              @on-page-size-change="pageSize=arguments[0];getdeliveredlist();"
              @on-change="getdeliveredlist"/>
    </template>

    <Modal v-model="modalreturnout" title="退回出库商品" @on-ok="doreturnout">


        <h3>该商品是否确定退回出库?</h3>
    </Modal>

    <Modal v-model="modalout" title="出库商品" @on-ok="doout">


        <h3>该商品是否确定出库?</h3>
    </Modal>
    </Modal>
</div>
</body>
<script>
    new  Vue({
        el:"#root",

        data:{
            columns:[
                {title: "商品名称", key: "deliveredName"},
                {title: "类型", key: "deliveredType"},
                {title: "出库数量", key: "deliveredQuantity"},
                {title: "成本价格", key: "deliveredUnitPrice"},
                {title: "销售价格", key: "deliveredTotalPrice"},
                {title: "出库时间", key: "deliveredDate"},
                {title:"操作",slot:"action"},
            ],
            data:[],
            Delivered:{},
            DeliveredVo:{},
            supplierlist:[],
            total:50,
            pageNo:1,
            pageSize:5,
            modalreturnout:false,
            modalout:false,

        },
        mounted(){
            this.getdeliveredlist();
        },
        methods:{
            getdeliveredlist(){
                axios.get(`${apath}/delivered/pagedeliveredlist/${this.pageSize}/${this.pageNo}`,{params:this.DeliveredVo})
                    .then(({data})=>{
                        console.log(data.result);
                        this.data=data.result.record;
                        this.total=data.result.total;
                    })
            },
            returnout(row,index){
                this.Delivered = row;
                this.modalreturnout=true;
            },
            doreturnout(){
                axios.post(`${apath}/delivered/deliveredaddRk`,this.Delivered)
                    .then(({data})=>{
                        iview.Message.success({content:data.msg})
                        this.getdeliveredlist();
                    })
            },
            out(row,index){
                this.Delivered = row;
                this.modalout=true;
            },
            doout(){
                axios.post(`${apath}/delivered/deliveredaddCK`,this.Delivered)
                    .then(({data})=>{
                        iview.Message.success({content:data.msg})
                        this.getdeliveredlist();
                    })
            }
        }
    })
</script>
</html>
